#define MAINSHARE_CPP
#include "mainshare.h"
#include <QObject>

QString sex2trSex(const QString &sex)
{
    if (sex.contains("M", Qt::CaseInsensitive)) return QObject::tr("M");
    else if (sex.contains("F", Qt::CaseInsensitive)) return QObject::tr("F");
    else return QObject::tr("O");
}

QString trSex2Sex(const QString &trsex)
{
    if (trsex == QObject::tr("M")) return QString("M");
    else if (trsex == QObject::tr("F")) return QString("F");
    else return QString("O");
}

QTime formatDicomTime(const QString &timeStr)
{
    if (timeStr.contains('.')) {
        return QTime::fromString(timeStr, "hhmmss.zzz");
    } else {
        return QTime::fromString(timeStr, TIME_DICOM_FORMAT);
    }
}
